/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hhf.worldzones.services.locationServices.regionServices;

import hhf.flex.annotations.FlexDestination;
import hhf.flex.annotations.services.AddEntities;
import hhf.flex.annotations.services.ArgumentName;
import hhf.flex.annotations.services.CacheServiceId;
import hhf.flex.annotations.services.GenericService;
import hhf.flex.annotations.services.OfflinePolicyEnum;
import hhf.flex.annotations.services.ReferenceGetter;
import hhf.flex.annotations.services.RemoveEntities;
import hhf.worldzones.entities.Region;
import hhf.worldzones.exceptions.RegionUnknownException;
import java.util.List;
import javax.ejb.Local;

/**
 *
 * @author HHFrancois
 */
@Local
@FlexDestination
public interface RegionFacadeLocal {

    @GenericService(offlinePolicy = OfflinePolicyEnum.DELAY)
    @AddEntities(entities = "region")
    void persist(@ArgumentName(value = "region") Region region);

    Region merge(Region region);

    /*@LinkedServices(canceledServices = {
    @CanceledService(methodClass = RegionFacadeLocal.class, method = "find", parameters = "toto.code")})
     */
    @GenericService(offlinePolicy = OfflinePolicyEnum.DELAY)
    @RemoveEntities(entities = "toto")
    void remove(@ArgumentName(value = "toto") Region region);

    @ReferenceGetter(acceptOutOfDate = true)
    Region find(@CacheServiceId String id) throws RegionUnknownException;

    @ReferenceGetter
    List<Region> findAll();

    @ReferenceGetter
    List<Region> findRange(int[] range);

    int count();
}
